//
//  Macros.h
//  GuChat
//
//  Created by iBenz on 14-10-13.
//  Copyright (c) 2014年 Guji Tech. All rights reserved.
//

#ifndef Macros_h
#define Macros_h

// 打印
#ifdef DEBUG
//#ifndef __OPTIMIZE__  //__OPTIMIZE__ 是release 默认会加的宏
    #define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
    #define NSLog(...)
#endif


/**
 *  版本
 */
#define AppVersion      [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] // 版本号，1.2.0
#define BUILDVERSION    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersionString"]      // 编译版本

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

/**
 *  屏幕大小
 */
#define ScreenBounds [[UIScreen mainScreen] bounds]
#define ScreenScale [UIScreen mainScreen].scale

#define kOnePixel (1.0/[UIScreen mainScreen].scale)
#define kSCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define kSCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

#define WeakRef(type)   __weak      typeof(type) weak##type     = type
#define StrongRef(type) __strong    typeof(type) strong##type   = type

#endif
